/*
 * Copyright (c) 2017 Kris Occhipint.
 * http://filmsbykris.com
 *
 * Basic Delay example without using time.h
 *
 * This program is free software: you can redistribute it and/or modify  
 * it under the terms of the GNU General Public License as published by  
 * the Free Software Foundation, version 3.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
#include<stdlib.h>
#include<stdio.h>

int delay(){
  int c = 1, d = 1;
  for ( c = 1 ; c <= 32767 ; c++ )
    for ( d = 1 ; d <= 32767 ; d++ )
    {}
  return 0;
}

int loop(){
  for (int i=1;i<=10;i++){
    fflush(stdout);
    printf("\rI'm counting: %d", i);
    delay(); 
  }
  //end with new line
  printf("\n");
  return 0;
}

int main(){
  printf("I'm going to count...\n");
  loop();
  return 0;
}